<script type="text/javascript">
    var oldtheme,oldaction,oldfunction;
    $(function () {
        $('input[name="type"]').change(
                function () {
                    var checkedval = $('input[name="type"]:checked').val();
                    if (checkedval == 'single') {
                        $('input[name="tpl_list_theme"]').attr('readonly', 'readonly');
                        oldtheme=$('input[name="tpl_list_theme"]').attr('value');
                        $('input[name="tpl_list_theme"]').attr('value', '');

                        $('input[name="tpl_list_path"]').attr('readonly', 'readonly');
                        oldfunction=$('input[name="tpl_list_path"]').attr('value');
                        $('input[name="tpl_list_path"]').attr('value', '');
                    }
                    else {
                        $('input[name="tpl_list_theme"]').removeAttr('readonly');
                        $('input[name="tpl_list_theme"]').attr('value', oldtheme);
                        $('input[name="tpl_list_path"]').removeAttr('readonly');
                        $('input[name="tpl_list_path"]').attr('value', oldfunction);
                    }
                }
        );

        var checkedval = $('input[name="type"]:checked').val();
        if (checkedval == 'single') {
            $('input[name="tpl_list_theme"]').attr('readonly', 'readonly');
            oldtheme=$('input[name="tpl_list_theme"]').attr('value');
            $('input[name="tpl_list_theme"]').attr('value', '');

            $('input[name="tpl_list_path"]').attr('readonly', 'readonly');
            oldfunction=$('input[name="tpl_list_path"]').attr('value');
            $('input[name="tpl_list_path"]').attr('value', '');
        }
    });
</script>
<div class="subnav">
    <if condition="$edititem">
        编辑频道
        <else/>
        新增频道
    </if>
</div>
<if condition="$edititem">
    <form action="__APP__/Channel/post_edit" method="post">
        <input type="hidden" name="id" value="{$edititem['id']}"/>
        <else/>
        <form action="__APP__/Channel/post_add" method="post">
</if>

<div class="ddtable">
    <div class="dlheader">基础设置</div>
    <dl>
        <dt>频道名称：</dt>
        <dd><input type="text" name="title" value="{$edititem['title']}"/></dd>
        <dt>频道标识：</dt>
        <dd><input type="text" name="en_title" value="{$edititem['en_title']}"/><span>输入英文标识名称，不填默认按拼音首字母命名</span></dd>
        <dt>频道类型：</dt>
        <dd>
            <div class="com-left">
                <label>
                    <if condition="$edititem['type'] eq 'list'">
                        <input type="radio" name="type" value="list" checked/>
                        <else/>
                        <input type="radio" name="type" value="list"/>
                    </if>
                    列表页</label><br/>
                <label>
                    <if condition="$edititem['type'] eq 'single'">
                        <input type="radio" name="type" value="single" checked/>
                        <else/>
                        <input type="radio" name="type" value="single"/>
                    </if>

                    单页(不可发布内容)</label>
            </div>
        </dd>
    </dl>
    <div class="dlheader">模版设置</div>
    <dl>
        <dt>列表页模版-主题名：</dt>
        <dd><input type="text" name="tpl_list_theme" value="{$edititem['tpl_list_theme']}"/></dd>
        <dt>列表页模版-模版路径：</dt>
        <dd><input type="text" name="tpl_list_path" value="{$edititem['tpl_list_path']}"/></dd>
        <dt>内容页模版-主题名：</dt>
        <dd><input type="text" name="tpl_content_theme" value="{$edititem['tpl_content_theme']}"/></dd>
        <dt>内容页模版-模版路径：</dt>
        <dd><input type="text" name="tpl_content_path" value="{$edititem['tpl_content_path']}"/></dd>
    </dl>
    <div class="dlheader">SEO设置
</div>
<dl>
    <dt>SEO：</dt>
    <dd><input type="text" name="seo" value="{$edititem['seo']}"/></dd>
    <dt>关键字：</dt>
    <dd><input type="text" name="keyword" value="{$edititem['keyword']}"/></dd>
    <dt>描述：</dt>
    <dd><input type="text" name="description" value="{$edititem['description']}"/></dd>
</dl>
</div>
<div class="formbtn">
    <div style="padding-left:300px;padding-top:40px;"><input type="submit" value="保存"/><input type="reset" value="重置"/>
    </div>
</div>

</form>
